package com.dm0858.bianmin.ui.presenter;

import com.dm0858.bianmin.model.response.ArticleCatResponse;
import com.dm0858.bianmin.ui.base.BasePresenter;
import com.dm0858.bianmin.view.IArticleCatView;
import com.socks.library.KLog;

import rx.Subscriber;

/**
 * Created by yelvqing on 2018/4/30.
 */

public class ArticleCatPresenter extends BasePresenter<IArticleCatView> {
    public ArticleCatPresenter(IArticleCatView view) {
        super(view);
    }

    public void getArticleCat() {
        addSubscription(mApiService.getArticleCat(), new Subscriber<ArticleCatResponse>() {
            @Override
            public void onCompleted() {

            }

            @Override
            public void onError(Throwable e) {

                e.printStackTrace();
                KLog.e(e.getLocalizedMessage());
                mView.onError();
            }

            @Override
            public void onNext(ArticleCatResponse response) {

                mView.onGetArticleCatSuccess(response);
            }

        });
    }

}
